//
//  Global.m
//  Demo
//
//  Created by Echo on 13-10-17.
//

#import "Global.h"

@implementation Global
+(void)SetSubViewExternNone:(UIViewController *)viewController
{
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 70000
    if ( IOS7_OR_LATER )
    {
        viewController.edgesForExtendedLayout = UIRectEdgeNone;
        
        [[UINavigationBar appearance] setTitleTextAttributes:@{UITextAttributeTextColor : [UIColor whiteColor]}];
        
        
//        UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, viewController.navigationItem.titleView.frame.size.width, 44)];
//        label.font = [UIFont systemFontOfSize:18];
//        label.textAlignment = UITextAlignmentCenter;
//        label.text = viewController.title;
//        label.textColor = [UIColor whiteColor];
//        viewController.navigationItem.titleView = label;
        //viewController.extendedLayoutIncludesOpaqueBars = NO;
        //viewController.modalPresentationCapturesStatusBarAppearance = NO;
        //viewController.navigationController.navigationBar.translucent = NO;
    }
#endif  // #if __IPHONE_OS_VERSION_MAX_ALLOWED >= 70000
}
+(void)enableVibrate{
    if ([[NSUserDefaults standardUserDefaults] boolForKey:ENABLE_VIBRATE_KEY]) {
        AudioServicesPlaySystemSound(kSystemSoundID_Vibrate);
    }
}
+(BOOL)curLanguageEn{
    NSString *curLan = [UD objectForKey:CUR_LANGUAGE];
    if ([curLan isEqualToString:EN]) {
        return YES;
    }
    return NO;
}
+(NSString*)chinaToEn:(NSString*)chinese_language{
    NSString *string = nil;
    if ([Global curLanguageEn]) {
        if ([chinese_language isEqualToString:STR(@"电视")]){
            string = @"TV";
        }else if ([chinese_language isEqualToString:STR(@"电视机")]){
            string = @"TV";
        }else if ([chinese_language isEqualToString:STR(@"空调")]){
            string = @"Air Conditioning";
        }else if ([chinese_language isEqualToString:STR(@"音响")]){
            string = @"Audio";
        }else if ([chinese_language isEqualToString:STR(@"小米盒子")]){
            string = @"Millet box";
        }else if ([chinese_language isEqualToString:STR(@"自定义")]){
            string = @"Custom";
        }else if ([chinese_language isEqualToString:STR(@"机顶盒")]){
            string = @"STB";
        }else if ([chinese_language isEqualToString:STR(@"触摸开关")]){
            string = @"RF switch";
        }
    }
    if (string) {
        return string;
    }else{
        return chinese_language;
    }
}
+(NSString*)enToChina:(NSString*)en_language{
    NSString *string = nil;
    if ([Global curLanguageEn]) {
        if ([en_language isEqualToString:@"TV"]){
            string = @"电视";
        }else if ([en_language isEqualToString:@"Air Conditioning"]){
            string = @"空调";
        }else if ([en_language isEqualToString:@"Audio"]){
            string = @"音响";
        }else if ([en_language isEqualToString:@"Custom"]){
            string = @"自定义";
        }else if ([en_language isEqualToString:@"Millet box"]){
            string = @"小米盒子";
        }else if ([en_language isEqualToString:@"STB"]){
            string = @"机顶盒";
        }else if ([en_language isEqualToString:@"Socket"]) {
            string = STR(@"触摸开关");
        }
    }
    if (string) {
        return string;
    }else{
        return en_language;
    }
}
@end
         
         
         
         
